/*
 * @FilePath: /gis-platform/src/router/index.js
 * @Author: 张文鑫
 * @Date: 2024-11-30 22:26:24
 * @Description:
 */
import { createRouter, createWebHistory } from "vue-router";
import { HomeFilled, Setting, Document, Menu } from "@element-plus/icons-vue";

// 引入组件
import DefaultLayout from "@/layouts/DefaultLayout.vue";

import Home from "@/views/Home.vue"; // 直接引入 Home 组件

import CityMarkers from "@/views/layer-management/layer-change/index.vue";
export const routes = [
  {
    path: "/",
    redirect: "/home", // 将根路径重定向到 /home
    meta: {
      showInSidebar: false, // 在 Sidebar 中显示此项
    },
  },
  {
    path: "/home",
    component: DefaultLayout, // 首页使用 DefaultLayout
    name: "首页",
    children: [
      {
        path: "", // 默认子路由
        component: Home, // 首页内容组件
        meta: {
          icon: HomeFilled,
          showInSidebar: true, // 在 Sidebar 中显示此项
        },
      },
    ],
  },
  {
    path: "/layer-management",
    component: DefaultLayout,
    name: "图层管理",
    meta: {
      icon: Setting,
      showInSidebar: true,
    },
    children: [
      {
        path: "/layer-management/layer-change",
        name: "图层切换",
        component: CityMarkers,
        meta: {
          showInSidebar: true,
        },
      },
      {
        path: "/layer-management/point-markers",
        name: "点线标注",
        component: () => import("@/views/layer-management/point-markers/index.vue"),
        meta: {
          showInSidebar: true,
        },
      },
      {
        path: "/layer-management/zoom",
        name: "缩放显示效果",
        component: () => import("@/views/layer-management/zoom/index.vue"),
        meta: {
          showInSidebar: true,
        },
      },
    ],
  },

  {
    path: "/spatial-analysis",
    component: DefaultLayout,
    name: "空间分析模块",
    meta: {
      icon: Document,
      showInSidebar: true,
    },
    children: [
      {
        path: "/spatial-analysis/map-view",
        name: "基础地图",
        component: () => import("@/views/spatial-analysis/MapView.vue"),
        meta: {
          showInSidebar: true,
        },
      },
      {
        path: "/spatial-analysis/buffer",
        name: "缓冲区分析",
        component: () => import("@/views/spatial-analysis/BufferAnalysis.vue"),
        meta: {
          showInSidebar: true,
        },
      },
      {
        path: "/spatial-analysis/overlay",
        name: "叠加分析",
        component: () => import("@/views/spatial-analysis/OverlayAnalysis.vue"),
        meta: {
          showInSidebar: true,
        },
      },
      {
        path: "/spatial-analysis/proximity",
        name: "邻近度分析",
        component: () => import("@/views/spatial-analysis/ProximityAnalysis.vue"),
        meta: {
          showInSidebar: true,
        },
      },
      {
        path: "/spatial-analysis/network",
        name: "网络分析",
        component: () => import("@/views/spatial-analysis/NetworkAnalysis.vue"),
        meta: {
          showInSidebar: true,
        },
      },
      {
        path: "/spatial-analysis/terrain",
        name: "地形分析",
        component: () => import("@/views/spatial-analysis/TerrainAnalysis.vue"),
        meta: {
          showInSidebar: true,
        },
      },
    ],
  },
  {
    path: "/test",
    component: () => import("@/views/test/index.vue"),
    name: "test",
    meta: {
      showInSidebar: false,
    },
  },
  {
    path: "/shaoxing-map",
    component: () => import("@/views/shaoxing-map/index.vue"),
    name: "ShaoxingMap",
    meta: {
      showInSidebar: false,
    },
  },
  {
    path: "/irs-map",
    component: () => import("@/views/irs-map/index.vue"),
    name: "IRSMap",
    meta: {
      showInSidebar: false,
    },
    children: [
      {
        path: "/shaoxing-map/index",
        name: "绍兴地图",
        component: () => import("@/views/shaoxing-map/index.vue"),
        meta: {
          showInSidebar: true,
        },
      },
      {
        path: "/irs-map/index",
        name: "IRS地图",
        component: () => import("@/views/irs-map/index.vue"),
        meta: {
          showInSidebar: true,
        },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
